<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }

    #dv {
      width: 300px;
      height: 300px;
      background-color: pink;
    }
  </style>
</head>

<body>
  <div id="dv"></div>
</body>
<script src="./js/jquery.js"></script>
<script>
  $(function () {
    $(document).on("click", function (e) {
      let target = $(e.target);
      if (target.closest("#dv").length == 0) { //点击id之外的地方触发
        //要实现的代码
        console.log(`lai`);
      };
    });
  });
</script>

</html>